package org.jivesoftware.smackx.workgroup.packet;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Packet;

public class Transcript extends IQ
{
  private List<Packet> packets;
  private String sessionID;

  public Transcript(String paramString)
  {
    this.sessionID = paramString;
    this.packets = new ArrayList();
  }

  public Transcript(String paramString, List<Packet> paramList)
  {
    this.sessionID = paramString;
    this.packets = paramList;
  }

  public String getChildElementXML()
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("<transcript xmlns=\"http://jivesoftware.com/protocol/workgroup\" sessionID=\"").append(this.sessionID).append("\">");
    Iterator localIterator = this.packets.iterator();
    while (true)
    {
      if (!(localIterator.hasNext()))
      {
        localStringBuilder.append("</transcript>");
        return localStringBuilder.toString();
      }
      localStringBuilder.append(((Packet)localIterator.next()).toXML());
    }
  }

  public List<Packet> getPackets()
  {
    return Collections.unmodifiableList(this.packets);
  }

  public String getSessionID()
  {
    return this.sessionID;
  }
}